home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
CRS
/
crs32.d81
/
examples.arc
/
TYPE.A
< prev
next >
Wrap
Text File
|
1989-12-01
|
4KB
|
107 lines
; type.asm
;--------------------------------------------------
; command: type/x <[d]:filename>
;--------------------------------------------------
status = $0090
stkey = $0091
poker = $0016
color = $00f1
int08 = $1708
int0c = $170c
int0d = $170d
int0e = $170e
sw1 = $1bfc
hexa = $b8c2
chkin = $ffc6
chrout = $ffd2
chrin = $ffcf
Right = 29
star = $0b00
.wor star
* = star
jmp type
dw Date
type ldx #1 ; input from %1
lda #0 ; don't care what file type
jsr int08 ; open for read and abort on error
bcs typxx ; disk error on open...abort
jsr chkin
bcs typxxx ; abort if error
ty0 jsr chrin ; get char
ldy status
jsr cvt
bit stkey ; test stop key
bpl typx ; its down...quit
tya ; was st=0?
beq ty0 ; ok...keep typing
bne typx ; done..exit
typxxx jsr int0c ; read ds$
typxx jsr int0d ; print it
typx jmp int0e ; close all and quit
cvt pha
lda sw1
cmp #"p" ; /p convert ASCII to PETSCII
beq a2p
cmp #"a" ; /a convert PETSCII to ASCII
beq p2a
cmp #"s" ; /s show as screen code
beq screen
cmp #"h" ; /h show as hex bytes
beq hex
pla
jmp chrout
screen pla
sty poker
ldx color
jsr $c003
lda #Right
jsr $c00c
ldy poker
rts
hex pla
jmp hexa
p2a pla
cmp #"a" ; petscii to ascii
bcc p2ax
cmp #$5b
bcs p2a2
ora #$20
bne p2ax
p2a2 cmp #$c1
bcc p2ax
cmp #$db
bcs p2ax
and #$7f
p2ax jmp chrout
a2p pla
cmp #"a" ; ascii to petscii
bcc a2px
cmp #$5b
bcs a2p2
ora #$80
bne a2px
a2p2 cmp #$61
bcc a2px
cmp #$7b
bcs a2px
and #$df
a2px cmp #10
bne a2pxx
rts
a2pxx jmp chrout
.end